<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Math</title>
    <script src="js/traceur.js"></script>
    <script src="js/bootstrap.js"></script>
    <script type="module">
        console.log(Math.sinh(0)); //正弦值
        console.log(Math.cosh(0)); //余弦值
        console.log(Math.tanh(0)); //正切值
        console.log(Math.asinh(0)); //反正弦值
        console.log(Math.acosh(1)); //反余弦值
        console.log(Math.atanh(0)); //反正切值
        console.log(Math.hypot(2, 2, 1));//毕达哥拉斯定理

        //算术操作符
        console.log(Math.log2(16));
        console.log(Math.log10(1000));
        console.log(Math.log1p(0)); //log(1 + value)
        console.log(Math.expm1(0)); // Math.log1p()
        console.log(Math.cbrt(8)); //一个值的立方根

        //32位相乘
        console.log(Math.imul(590, 5000000)); //32位整数乘法 -1344967296
        console.log(590 * 5000000); //64位浮点乘法 2950000000

        console.log(Math.clz32(7)); //29
        console.log(Math.clz32(1000)); //22
        console.log(Math.clz32(295000000)); //3

        //判断数字为负，0，正
        console.log(Math.sign(11)); // 1
        console.log(Math.sign(-11)); // -1
        console.log(Math.sign(0)); // 0

        //删除小数，返回整数
        console.log(Math.trunc(11.17));  // 11
        console.log(Math.trunc(-1.112)); // -1

        console.log(Math.fround(0)); // 0
        console.log(Math.fround(1)); // 1
        console.log(Math.fround(1.137)); // 1.1369999647140503
        console.log(Math.fround(1.5)); // 1.5
    </script>
</head>
<body>

</body>
</html>